//
//  FreedomTableViewCell.m
//  Qyer
//
//  Created by 赵宇 on 15/9/15.
//  Copyright (c) 2015年 赵宇. All rights reserved.
//

#import "FreedomTableViewCell.h"
#import "BaseHeader.h"
@implementation FreedomTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.photoView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, SCREEN_WIDTH/3, SCREEN_HEIGHT/6)];
        [self.contentView addSubview:self.photoView];
        
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.photoView.frame.size.width +10, 0, SCREEN_WIDTH/3*2 - 10, SCREEN_HEIGHT/10)];
        [self.titleLabel setNumberOfLines:2];
        self.titleLabel.font = [UIFont systemFontOfSize:15.];
        [self.contentView addSubview:self.titleLabel];
        
        self.priceoffLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.photoView.frame.size.width +15, self.photoView.frame.size.height - 30, 60, 30)];
        self.priceoffLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:self.priceoffLabel];
        
        self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/4*3, self.photoView.frame.size.height - 35, SCREEN_WIDTH/4, 40)];
        self.priceLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:self.priceLabel];
        
    }
    return self;
}
-(void)getValueWithModel:(freeModel *)model
{
    NSURL *url = [NSURL URLWithString:model.photo];
    [self.photoView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.titleLabel.text = model.title;
    self.priceoffLabel.text = model.priceoff;
    NSString *str =[model.price substringWithRange:NSMakeRange(4, model.price.length - 4 - 7)];
    NSString *string = [NSString stringWithFormat:@"%@元起",str];
    self.priceLabel.text = string;
}
-(void)getvalueWithLacalModel:(LocalModel *)localmod
{
    NSURL *url = [NSURL URLWithString:localmod.photo];
    [self.photoView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.titleLabel.text = localmod.title;
    self.priceoffLabel.text = localmod.priceoff;
    NSString *str =[localmod.price substringWithRange:NSMakeRange(4, localmod.price.length - 4 - 7)];
    NSString *string = [NSString stringWithFormat:@"%@元起",str];
    self.priceLabel.text = string;

}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
